home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Windows Selection / Windows Selection 1.iso / Programmer's Utilities / Freeman Installer / dlgbox.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-10  |  1.2 KB  |  71 lines

  1. #define __DLGBOX_H
  2.  
  3. #ifndef __AWNDOBJ_H
  4. #include "awndobj.h"
  5. #endif
  6.  
  7. class dlgboxobj:public abswndobj
  8. {
  9.    int isdel;
  10.  
  11.    public:
  12.  
  13.    dlgboxobj(int isdel_ = 0)
  14.    {
  15.       dlg = 0;
  16.  
  17.       isdel = isdel_;
  18.    }
  19.   ~dlgboxobj()
  20.    {
  21.       if (isdel && dlg != 0)
  22.       {
  23.          MessageBox(0, "del() must be called before destruction", 0, MB_OK);
  24.          #if 0
  25.          del();               /* del() -> DestryWindow() -> dlgproc -> onmsg() */
  26.          #endif
  27.       }
  28.    }
  29.    void del()
  30.    {
  31.       if (dlg != 0)
  32.       {
  33.          DestroyWindow(dlg);
  34.       }
  35.       dlg = 0;
  36.    }
  37.    void setret(LRESULT r)
  38.    {
  39.       SetWindowLong(dlg, DWL_MSGRESULT, r);
  40.    }
  41.    void end(int r)
  42.    {
  43.       EndDialog(dlg, r);
  44.    } 
  45.    HWND getdlg()
  46.    {
  47.       return dlg;
  48.    }
  49.    HWND getwnd()
  50.    {
  51.       return dlg;
  52.    }
  53.  
  54.    HWND dlg;
  55.  
  56.    virtual BOOL onmsg(UINT msg, WPARAM wp, LPARAM lp) = 0;
  57.  
  58.    int go(HWND owner, int dlgid);
  59.    int go(HWND owner, char dlgname[]);
  60.    int create(HWND owner, int dlgid);
  61.    int create(HWND owner, char dlgname[]);
  62.  
  63.  
  64.    static int dlgtopixelx(int x);
  65.    static int dlgtopixely(int y);
  66.    #ifdef WIN32
  67.    static DLGTEMPLATE *loadtmpl(char dlgname[]);
  68.    #endif
  69. };
  70.  
  71.